<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>转成布尔型</title>
	</head>
	<body>
		<p>请输入：</p>
		<input type="text" id="a" />
		<br />
		<br />
		<input type="button" id="btn" value="确定" onclick="b()" />
		<p id="sum"></p>
		<script>
			
			function b(){
				var num1=document.getElementById('a');
				var result=document.getElementById('sum');
				console.log(typeof(num1));
				
				if(!Boolean(num1.value.trim())){
					alert("您还未输入！");
					return;
				}
			if(isNaN(num1.value)){
				alert("输入不合法，非数字型");
				return;
			}else{
				result.innerHTML=Number(num1.value)*2*3.14;
			}
			}
		</script>
	</body>
</html>
